#pragma once
#include "MysqlDao.hpp"
#include "message.grpc.pb.h"
#include "message.pb.h"
#include <grpcpp/grpcpp.h>
#include <grpcpp/server.h>
#include <grpcpp/server_builder.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/status.h>
#include <memory>
#include <mutex>
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
using message::AddFriendReq;
using message::AddFriendRsp;

using message::ReplyfriendReq;
using message::ReplyFriendRsp;

using message::AuthFriendReq;
using message::AuthFriendRsp;

using message::ChatService;
using message::TextChatMsgReq;
using message::TextChatMsgRsp;

class ChatServiceImpl final : public ChatService::Service {
public:
  ChatServiceImpl();
  Status NotifyAddFriend(::grpc::ServerContext *context,
                         const ::message::AddFriendReq *request,
                         ::message::AddFriendRsp *response) override;
  Status RplyAddFriend(::grpc::ServerContext *context,
                       const ::message::ReplyfriendReq *request,
                       ::message::ReplyFriendRsp *response) override;
  Status SendChatMsg(::grpc::ServerContext *context,
                     const ::message::SendChatMsgReq *request,
                     ::message::SendChatMsgRsp *response) override;
  Status NotifyAuthFriend(::grpc::ServerContext *context,
                          const ::message::AuthFriendReq *request,
                          ::message::AuthFriendRsp *response) override;
  Status NotifyTextChatMsg(::grpc::ServerContext *context,
                           const ::message::TextChatMsgReq *request,
                           ::message::TextChatMsgRsp *response) override;
  bool GetBaseInfo(std::string &base_key, int uid,
                   std::shared_ptr<UserInfo> &userInfo);

private:
};